﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AdaptiveAgents.Tools
{
    class DoubleComperator
    {

        public static double getBiggest(double num0, double num1, double num2)
        {
            if ((num1 < num0) && (num2 < num0))
                return num0;
            if ((num0 < num1) && (num2 < num1))
                return num1;
            if ((num0 < num2) && (num1 < num2))
                return num2;
            return 0;
        }

        public static double getSmallest(double num0, double num1, double num2)
        {
            if ((num1 > num0) && (num2 > num0))
                return num0;
            if ((num0 > num1) && (num2 > num1))
                return num1;
            if ((num0 > num2) && (num1 > num2))
                return num2;
            return 0;
        }

        public static double getMiddle(double num0, double num1, double num2)
        {
            if ((num1 < num0) && (num0 < num2))
                return num0;
            if ((num2 < num0) && (num0 < num1))
                return num0;
            if ((num0 < num1) && (num1 < num2))
                return num1;
            if ((num2 < num1) && (num1 < num0))
                return num1;
            if ((num0 < num2) && (num2 < num1))
                return num2;
            if ((num1 < num2) && (num2 < num0))
                return num2;
            return 0;
        }

        public static int getPosition(double num0, double num1, double num2)
        {
            if ((num1 < num0) && (num2 < num0))
                return 2;
            if ((num1 > num0) && (num2 > num0))
                return 0;
            if ((num1 < num0) && (num0 < num2))
                return 1;
            if ((num2 < num0) && (num0 < num1))
                return 1;
            return -1;
        }
    }
}
